﻿<phoneNavigation:PhoneApplicationPage
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phoneNavigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Navigation"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:Phone7ActionPack_BingMaps_ValueConverters="clr-namespace:Phone7ActionPack.BingMaps.ValueConverters;assembly=Phone7ActionPack.BingMaps" 
	xmlns:Phone7ActionPack_Controls="clr-namespace:Phone7ActionPack.Controls;assembly=Phone7ActionPack" 
	xmlns:Microsoft_Maps_MapControl="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" 
	xmlns:Microsoft_Maps_MapControl1="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl.Common" 
	xmlns:Microsoft_Maps_MapControl_Navigation="clr-namespace:Microsoft.Maps.MapControl.Navigation;assembly=Microsoft.Maps.MapControl" 
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:Phone7ActionPack_BingMaps="clr-namespace:Phone7ActionPack.BingMaps;assembly=Phone7ActionPack.BingMaps" xmlns:Phone7ActionPack_Actions="clr-namespace:Phone7ActionPack.Actions;assembly=Phone7ActionPack" 
	xmlns:im="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions" 
	x:Class="P7AP.Samples.BingMapsLocationControl.MainPage"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
	>

	<phoneNavigation:PhoneApplicationPage.Resources>
		<!--<Microsoft_Maps_MapControl1:Location Latitude="40.3451013565063" Longitude="-74.6422882080078" x:Key="test" />-->
		
		<DataTemplate x:Key="PastLocationTemplate">
			<Microsoft_Maps_MapControl:Pushpin 
				Microsoft_Maps_MapControl:MapLayer.Position="{Binding Location}" />
		</DataTemplate>

	</phoneNavigation:PhoneApplicationPage.Resources>
	<phoneNavigation:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phoneNavigation:PhoneApplicationPage.FontFamily>
	<phoneNavigation:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phoneNavigation:PhoneApplicationPage.FontSize>
	<phoneNavigation:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phoneNavigation:PhoneApplicationPage.Foreground>

	<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<!--TitleGrid is the name of the application and page title-->
		<Grid x:Name="TitleGrid" Grid.Row="0">
			<TextBlock Text="MY APPLICATION" x:Name="textBlockPageTitle" Style="{StaticResource PhoneTextPageTitle1Style}"/>
			<TextBlock Text="page title" x:Name="textBlockListTitle" Style="{StaticResource PhoneTextPageTitle2Style}"/>
		</Grid>

		<!--ContentGrid is empty. Place new content here-->
		<Grid x:Name="ContentGrid" Grid.Row="1">
			<Phone7ActionPack_BingMaps:LocationCollectionControl x:Name="locationControl" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,100,0,0" LocationWatcherEnabled="{Binding IsChecked, ElementName=toggleButton}" UseEmulation="True">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="LocationChanged">
						<Phone7ActionPack_BingMaps:LocationChangedCenterMapAction TargetName="map"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</Phone7ActionPack_BingMaps:LocationCollectionControl>
			<ToggleButton x:Name="toggleButton" Content="ToggleButton" HorizontalAlignment="Right" Margin="0,-118,20,0" Style="{StaticResource PhoneToggleSwitch}" VerticalAlignment="Top" Click="toggleButton_Click"/>
			<Microsoft_Maps_MapControl:Map x:Name="map" d:LayoutOverrides="Width, Height" LogoVisibility="Collapsed" ZoomLevel="1.25971" CredentialsProvider="AsrnrmOS52AVARzooVsih3T3YNsWdHghT_azX2D8Kliu7Px5bMU_TgrVcLgkx5mM">
				
				<Microsoft_Maps_MapControl:MapItemsControl 
					ItemsSource="{Binding LocationCollection, ElementName=locationControl}" 
					ItemTemplate="{StaticResource PastLocationTemplate}">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="MouseLeftButtonDown">
							<im:ControlStoryboardAction/>
						</i:EventTrigger>
					</i:Interaction.Triggers>
				</Microsoft_Maps_MapControl:MapItemsControl>
			</Microsoft_Maps_MapControl:Map>
		</Grid>
		
	</Grid>
	
</phoneNavigation:PhoneApplicationPage>